package org.example.web;


import com.example.fanqie.entity.Author;
import com.example.fanqie.entity.User;
import com.example.fanqie.mapper.AuthorMapper;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

@RestController
@RequestMapping("/author")
public class authorDao {


    @Resource
    private AuthorMapper  authorMapper;


    @RequestMapping("add")
    public int add(@RequestBody Author author){
        int insert = authorMapper.insert(author);
        return insert;

    }


    @RequestMapping("select")
    public List<Author> selectauthor(  ){

        List<Author> authors = authorMapper.selectauthor();
//        System.out.println(users);

        return authors;
    }

    @RequestMapping("update")
    public int updateauthor( @RequestBody Author author){

        int update = authorMapper.updateById(author);

        return update;
    }

    @RequestMapping("delete")
    public int deleteadmin( @RequestBody Author author){

        int delete = authorMapper.updateById(author);

        return delete;
    }

}
